From fe70dfffc58f1648590be59bae7d5e58c99dadaa Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 13 May 2006 19:29:24 +0000 Subject: [PATCH] Fix #5918: links autonumbering now work for all defined protocols. --- RELEASE-NOTES | 1 + includes/Parser.php | 4 ++-- maintenance/parserTests.txt | 23 ++++++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 750e175a69..ddcf1f4326 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -257,6 +257,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5833) Introduce CURRENTVERSION magic word * (bug 5370) Allow throttling of password reminder requests with the rate limiter * (bug 5683) Respect parser output marked as uncacheable when saving +* (bug 5918) Links autonumbering now work for all defined protocols == Compatibility == diff --git a/includes/Parser.php b/includes/Parser.php index ec6f11e2db..9a8405355b 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1161,8 +1161,8 @@ class Parser # No link text, e.g. [http://domain.tld/some.link] if ( $text == '' ) { - # Autonumber if allowed - if ( strpos( HTTP_PROTOCOLS, str_replace('/','\/', $protocol) ) !== false ) { + # Autonumber if allowed. See bug #5918 + if ( strpos( wfUrlProtocols(), substr($protocol, 0, strpos($protocol, ':')) ) !== false ) { $text = '[' . ++$this->mAutonumber . ']'; $linktype = 'autonumber'; } else { diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index cc1eeb69c4..259e75585f 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1045,7 +1045,7 @@ Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2 !! result -
ftp://|x" onmouseover="alert(document.cookie)">test +[1]" onmouseover="alert(document.cookie)">test
@@ -3949,6 +3949,27 @@ HTML nested ordered list, open tags (bug 5497) !! end +!!test +bug 5918: autonumbering +!! input +[http://first/] [http://second] [ftp://ftp] + +ftp://inlineftp + +[mailto:enclosed@mail.tld With target] + +[mailto:enclosed@mail.tld] + +mailto:inline@mail.tld +!! result +

[1] [2] [3] +

ftp://inlineftp +

With target +

[4] +

mailto:inline@mail.tld +

+!! end + # # # -- 2.20.1